1 /*
2 * Title: S/MIME Project
3 * Description: S/MIME email sending capabilities
4 * @Author Vladimir Radisic
5 * @Version 2.0.1
6 */
7
8
9 package org.webdocwf.util.smime.cms;
10
11
12 import org.webdocwf.util.smime.exception.SMIMEException;
13 import org.webdocwf.util.smime.der.DERSequencePr;
14 import java.security.cert.X509Certificate;
15
16
17 /***
18 * IssuerAndSerialNumber class is DER encoded object represented in ASN.1
19 * notation according to RFC2630. It is used on places where's important
20 * to obtain information about particular certificate. It contains issuer's
21 * data (name, country etc.) and serial number of the certificate. This class
22 * is super class of classes RecipientIdentifier and SignerIdentifier.<BR>
23 * <BR>
24 * <DL>
25 * IssuerAndSerialNumber ::= SEQUENCE {<BR>
26 * <DD> issuerName Name,<BR>
27 * <DD> serialNumber CertificateSerialNumber }<BR>
28 * </DL>
29 * <BR>
30 * Name ::= CHOICE { <BR>
31 * <DD> RDNSequence }<BR>
32 * <BR>
33 * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName<BR>
34 * <BR>
35 * RelativeDistinguishedName ::= SET OF AttributeTypeAndValue<BR>
36 * <BR>
37 * <DD>
38 * AttributeTypeAndValue ::= SEQUENCE { <BR>
39 * <DD> type AttributeType, <BR>
40 * <DD> value AttributeValue }<BR>
41 * </DL>
42 * <BR>
43 * AttributeType ::= OBJECT IDENTIFIER<BR>
44 * <BR>
45 * AttributeValue ::= ANY DEFINED BY AttributeType<BR>
46 * <BR>
47 * <DL>
48 * DirectoryString ::= CHOICE {<BR>
49 * <DD> teletexString TeletexString (SIZE (1..MAX)),<BR>
50 * <DD> printableString PrintableString (SIZE (1..MAX)),<BR>
51 * <DD> universalString UniversalString (SIZE (1..MAX)),<BR>
52 * <DD> utf8String UTF8String (SIZE (1.. MAX)),<BR>
53 * <DD> bmpString BMPString (SIZE (1..MAX)) }<BR>
54 * </DL>
55 * <BR>
56 * CertificateSerialNumber ::= INTEGER<BR>
57 */
58 public class IssuerAndSerialNumber extends DERSequencePr {
59
60 /***
61 * Construction with information got from specific X509Certificate or from .cer
62 * file information which is extracted into instance of X509Certificate class
63 * @param cert0 X509Certificate
64 * @exception SMIMEException thrown from super class constructor or addContent
65 * method.
66 */
67 public IssuerAndSerialNumber(X509Certificate cert0) throws SMIMEException {
68 IssuerName isName = new IssuerName(cert0);
69
70 isName.addAllRelativeDN(); // All distinguish name from certificate is copyed in to issuer name
71 super.addContent(isName.getDEREncoded());
72 super.addContent(new CertificateSerialNumber(cert0.getSerialNumber()).getDEREncoded());
73 }
74 }
75
This page was automatically generated by Maven